class Role {
  Role({
    this.id,
    this.authority,
    this.title,
    this.description,
  });

  factory Role.fromJson(Map<String, dynamic> json) {
    return Role(
      id: json['id']?.toString(),
      authority: json['authority']?.toString(),
      title: json['title']?.toString(),
      description: json['description']?.toString(),
    );
  }

  String? id;
  String? authority;
  String? title;
  String? description;

  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'authority': authority,
      'title': title,
      'description': description,
    };
  }

  /// Checks if the input [role] has the same id.
  bool equals(Role role) {
    return id == role.id;
  }

  /// Clones a [Role] with same [id] and [title] values.
  Role clone() {
    return Role(
      id: id,
      authority: authority,
      title: title,
      description: description,
    );
  }
}
